package com.eshop.modules.system.domain;

import java.lang.annotation.Annotation;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import java.util.Objects;
import java.sql.Timestamp;
import javax.validation.constraints.NotBlank;
import java.util.Set;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.eshop.domain.BaseDomain;

@TableName("user")
public class User extends BaseDomain
{
    @TableId
    private Long id;
    private Long avatarId;
    private String email;
    private Boolean enabled;
    @TableField(exist = false)
    private String avatar;
    @TableField(exist = false)
    private Set<Role> roles;
    @TableField(exist = false)
    private Job job;
    @TableField(exist = false)
    private Dept dept;
    private String password;
    @NotBlank(message = "请填写用户名称")
    private String username;
    private Long deptId;
    @NotBlank(message = "请输入手机号码")
    private String phone;
    private Long jobId;
    private Timestamp lastPasswordResetTime;
    private String nickName;
    private String sex;
    
    public boolean equals(final Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || this.getClass() != o.getClass()) {
            return false;
        }
        final User user = (User)o;
        return Objects.equals(this.id, user.id) && Objects.equals(this.username, user.username);
    }
    
    public int hashCode() {
        return Objects.hash(this.id, this.username);
    }
    
    public void copy(final User source) {
        BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
    }
    
    public Long getId() {
        return this.id;
    }
    
    public Long getAvatarId() {
        return this.avatarId;
    }
    
    public String getEmail() {
        return this.email;
    }
    
    public Boolean getEnabled() {
        return this.enabled;
    }
    
    public String getAvatar() {
        return this.avatar;
    }
    
    public Set<Role> getRoles() {
        return this.roles;
    }
    
    public Job getJob() {
        return this.job;
    }
    
    public Dept getDept() {
        return this.dept;
    }
    
    public String getPassword() {
        return this.password;
    }
    
    public String getUsername() {
        return this.username;
    }
    
    public Long getDeptId() {
        return this.deptId;
    }
    
    public String getPhone() {
        return this.phone;
    }
    
    public Long getJobId() {
        return this.jobId;
    }
    
    public Timestamp getLastPasswordResetTime() {
        return this.lastPasswordResetTime;
    }
    
    public String getNickName() {
        return this.nickName;
    }
    
    public String getSex() {
        return this.sex;
    }
    
    public void setId(final Long id) {
        this.id = id;
    }
    
    public void setAvatarId(final Long avatarId) {
        this.avatarId = avatarId;
    }
    
    public void setEmail(final String email) {
        this.email = email;
    }
    
    public void setEnabled(final Boolean enabled) {
        this.enabled = enabled;
    }
    
    public void setAvatar(final String avatar) {
        this.avatar = avatar;
    }
    
    public void setRoles(final Set<Role> roles) {
        this.roles = roles;
    }
    
    public void setJob(final Job job) {
        this.job = job;
    }
    
    public void setDept(final Dept dept) {
        this.dept = dept;
    }
    
    public void setPassword(final String password) {
        this.password = password;
    }
    
    public void setUsername(final String username) {
        this.username = username;
    }
    
    public void setDeptId(final Long deptId) {
        this.deptId = deptId;
    }
    
    public void setPhone(final String phone) {
        this.phone = phone;
    }
    
    public void setJobId(final Long jobId) {
        this.jobId = jobId;
    }
    
    public void setLastPasswordResetTime(final Timestamp lastPasswordResetTime) {
        this.lastPasswordResetTime = lastPasswordResetTime;
    }
    
    public void setNickName(final String nickName) {
        this.nickName = nickName;
    }
    
    public void setSex(final String sex) {
        this.sex = sex;
    }
    
    public @interface Update {
    }
}
